package com.chen.mobiletwo.tool;

import org.springframework.stereotype.Component;
import org.springframework.util.DigestUtils;

@Component
public class MD5Tool {
    /**
     * 将字符串转为MD5
     * @param s 带转换的字符串
     * @return String (MD5形式)
     */
    public String ToMD5(String s){
        try {
            return DigestUtils.md5DigestAsHex(s.getBytes("UTF-8"));
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }
    }
}
